package pua.uniandes.interfaz;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

public class PanelBotones extends JPanel implements ActionListener{
	
	public final static String CREARMISION="Crear";
	public final static String INICIARMISION="Iniciar";
	public final static String CANCELARMISION="Cancelar";
	
	private InterfazCentroMonitoreo interfazP;
	private JButton btnCrearMision;
	private JButton btnIniciarMision;
	private JButton btnCancelarMision;
	
	public PanelBotones(InterfazCentroMonitoreo inter)
	{
		interfazP=inter;
		btnCrearMision=new JButton("Crear Misión");
		btnCrearMision.setActionCommand(CREARMISION);
		btnCrearMision.addActionListener(this);
		btnIniciarMision= new JButton("Iniciar Misión");
		btnIniciarMision.setActionCommand(INICIARMISION);
		btnIniciarMision.addActionListener(this);
		btnCancelarMision=new JButton("Cancelar Misión");
		btnCancelarMision.setActionCommand(CANCELARMISION);
		btnCancelarMision.addActionListener(this);
		
		setBorder(new TitledBorder("Panel Misión"));
		setLayout(new GridLayout(1, 3));
		add(btnCrearMision);
		add(btnIniciarMision);
		add(btnCancelarMision);
	}

	public boolean iniciarMision(){
		
		return false;
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		String command=e.getActionCommand();
		if(command.equals(CREARMISION)){
			interfazP.dialogCrearMision();
		}
		else if (command.equalsIgnoreCase(INICIARMISION)){
			interfazP.dialogIniciarMision();
		}
		else System.out.println(CANCELARMISION);
	}
}
